home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / x / volume9 / xv / patch1 < prev    next >
Encoding:
Internet Message Format  |  1990-10-18  |  40.2 KB

  1. Path: uunet!cs.utexas.edu!sun-barr!newstop!sun!grip.cis.upenn.edu
  2. From: bradley@grip.cis.upenn.edu (John Bradley)
  3. Newsgroups: comp.sources.x
  4. Subject: v09i100: xv, Patch1, Part01/01
  5. Message-ID: <143883@sun.Eng.Sun.COM>
  6. Date: 18 Oct 90 17:33:17 GMT
  7. References: <csx-09i100:xv@uunet.UU.NET>
  8. Sender: news@sun.Eng.Sun.COM
  9. Lines: 1538
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: bradley@grip.cis.upenn.edu (John Bradley)
  13. Posting-number: Volume 9, Issue 100
  14. Archive-name: xv/patch1
  15. Patch-To: xv: Volume 9, Issue 76-83
  16.  
  17. Minor patches to XV:  
  18.   * modifications for SYSV systems and Convex systems
  19.  
  20.   * a 'vprintf' module has been added to allow it to run on 
  21.          machines that don't have 'vprintf' in the standard library
  22.          (BSD 4.3 machines), 
  23.  
  24.   * problems with 'olwm' fixed
  25.  
  26.   * an Imakefile has been added
  27.  
  28.   * quieter compilation on paranoid compilers
  29.  
  30.   * an icon has been added
  31.  
  32.   * and, of course, some bugs have been fixed
  33.  
  34. John Bradley  -  University of Pennsylvania  -  GRASP Lab
  35.  (bradley@cis.upenn.edu)
  36.  
  37.  
  38. (apply with 'patch -p <filename')
  39.  
  40. ---------------------------(cut here)-----------------------------
  41. *** ../xv1/README    Wed Oct 17 23:26:22 1990
  42. --- ./README    Wed Oct 17 15:03:31 1990
  43. ***************
  44. *** 1,8 ****
  45.   Installation
  46.   ------------
  47. ! Check the Makefile for the configuration option(s).  'make'.  Enjoy.
  48.   
  49.   
  50.   Caveats
  51.   -------
  52.   
  53. --- 1,13 ----
  54.   Installation
  55.   ------------
  56. ! If you don't plan to use Imake, copy 'Makefile.std' (a regular old-style
  57. ! minimalist makefile, not one created by Imake) to 'Makefile'.
  58.   
  59. + Check the Makefile for the configuration option(s).  Make it.
  60.   
  61. + Otherwise, check the Imakefile, and make the program however you normally 
  62. + would.
  63.   Caveats
  64.   -------
  65.   
  66. ***************
  67. *** 26,34 ****
  68.   Provided you don't have some odd-ball 5-bit StaticColor display, it should
  69.   work for you.
  70.   
  71. ! One note:  on some machines, the function 'vsprintf' (a VARARGS sprintf())
  72. ! doesn't exist.  You won't be able to compile on these machines.  They are
  73. ! wrong.
  74.   
  75.   
  76.   Bizarrities
  77. --- 31,38 ----
  78.   Provided you don't have some odd-ball 5-bit StaticColor display, it should
  79.   work for you.
  80.   
  81. ! 'vsprintf.c' has been included for the benefit of those on machines that
  82. ! don't have it.  (IBM RT AOS 4.3 and BSD 4.3 on VAX)
  83.   
  84.   
  85.   Bizarrities
  86.  
  87. *** ../xv1/bggen.c    Wed Oct 17 23:26:01 1990
  88. --- ./bggen.c    Wed Oct 17 18:39:27 1990
  89. ***************
  90. *** 5,10 ****
  91. --- 5,11 ----
  92.    *   (bradley@cis.upenn.edu)
  93.    *
  94.    *      Rev: 8/31/90
  95. +  *      Rev: 10/17/90  -  added '-w' option
  96.    */
  97.   
  98.   /*
  99. ***************
  100. *** 39,52 ****
  101.   {
  102.     int i,j,cnt,numcols;
  103.     int high = DEFSIZE;
  104.     int bits = 8;
  105.     int r, g, b;
  106. -   int bandsize;
  107.   
  108.     cnt = 0;  numcols = 0;
  109.     for (i=1; i<argc; i++) {
  110.       if (!strcmp(argv[i],"-s")) high = atoi(argv[++i]);
  111.   
  112.       else if (!strcmp(argv[i],"-b")) bits = atoi(argv[++i]);
  113.   
  114.       else if (argv[i][0]=='-') break;     /* any other '-' option is
  115. unknown */
  116. --- 40,55 ----
  117.   {
  118.     int i,j,cnt,numcols;
  119.     int high = DEFSIZE;
  120. +   int wide = 1;
  121.     int bits = 8;
  122.     int r, g, b;
  123.   
  124.     cnt = 0;  numcols = 0;
  125.     for (i=1; i<argc; i++) {
  126.       if (!strcmp(argv[i],"-s")) high = atoi(argv[++i]);
  127.   
  128. +     else if (!strcmp(argv[i],"-w")) wide = atoi(argv[++i]);
  129.       else if (!strcmp(argv[i],"-b")) bits = atoi(argv[++i]);
  130.   
  131.       else if (argv[i][0]=='-') break;     /* any other '-' option is
  132. unknown */
  133. ***************
  134. *** 68,78 ****
  135.   
  136.   
  137.     if (cnt || numcols==0 || high<1 || bits<1 || bits>8) {
  138. !     fprintf(stderr,"usage:  %s [-s size] [-b bits] r1 g1 b1 [r2 g2 b2
  139. ...]\n\n"
  140. !         ,argv[0]);
  141. !     fprintf(stderr,"\tThis will generate a 1xSIZE vertical color band.\n");
  142. !     fprintf(stderr,"\t(SIZE defaults to %d.)  To set your background\n",
  143. !         DEFSIZE);
  144.       fprintf(stderr,"\t'bits' is the number of significant bits in the\n");
  145.       fprintf(stderr,"\tcolor specifications.  (1-8)\n");
  146.       fprintf(stderr,"\tpipe the resulting output into this cmd:\n");
  147. --- 71,80 ----
  148.   
  149.   
  150.     if (cnt || numcols==0 || high<1 || bits<1 || bits>8) {
  151. !     fprintf(stderr,"usage:  %s [-s size] [-w width] [-b bits] %s\n\n",
  152. !         argv[0], "r1 g1 b1 [r2 g2 b2 ...]");
  153. !     fprintf(stderr,"\tThis will generate a WIDTHxSIZE vertical color
  154. band.\n");
  155. !     fprintf(stderr,"\t(Default: 1x%d)  To set your background\n",DEFSIZE);
  156.       fprintf(stderr,"\t'bits' is the number of significant bits in the\n");
  157.       fprintf(stderr,"\tcolor specifications.  (1-8)\n");
  158.       fprintf(stderr,"\tpipe the resulting output into this cmd:\n");
  159. ***************
  160. *** 80,91 ****
  161.       exit(1);
  162.     }
  163.   
  164. !   printf("P3 1 %d 255\n",high);
  165.   
  166.     /* special case code for numcols==1 */
  167.   
  168.     if (numcols==1) {
  169. !     for (i=0; i<high; i++) printf("%d %d
  170. %d\n",cols[0].r,cols[0].g,cols[0].b);
  171.     }
  172.     else {
  173.   
  174. --- 82,95 ----
  175.       exit(1);
  176.     }
  177.   
  178. !   printf("P3 %d %d 255\n",wide,high);
  179.   
  180.     /* special case code for numcols==1 */
  181.   
  182.     if (numcols==1) {
  183. !     for (i=0; i<high; i++) 
  184. !       for (j=0; j<wide; j++)
  185. !     printf("%d %d %d\n",cols[0].r,cols[0].g,cols[0].b);
  186.     }
  187.     else {
  188.   
  189. ***************
  190. *** 107,115 ****
  191.         g = g & bmask[bits-1];
  192.         b = b & bmask[bits-1];
  193.   
  194. !       printf("%d %d %d\n",r,g,b);
  195.       }
  196.     }
  197.   }
  198.   
  199.   
  200. --- 111,122 ----
  201.         g = g & bmask[bits-1];
  202.         b = b & bmask[bits-1];
  203.   
  204. !       for (j=0; j<wide; j++)
  205. !     printf("%d %d %d\n",r,g,b);
  206.       }
  207.     }
  208.   }
  209.   
  210.   
  211. *** ../xv1/xv.c    Wed Oct 17 23:25:56 1990
  212. --- ./xv.c    Wed Oct 17 19:35:52 1990
  213. ***************
  214. *** 26,31 ****
  215. --- 26,32 ----
  216.   #define NEEDSDIR     /* for value of MAXPATHLEN */
  217.   
  218.   #include "xv.h"
  219. + #include "bitmaps.h"
  220.   
  221.   #include <X11/Xatom.h>
  222.   
  223. ***************
  224. *** 87,94 ****
  225.   static void TrackPicValues();
  226.   static void MakeDispNames();
  227.   static int  Rect();
  228. ! static int  CheckForConfig();
  229. ! static Bool IsConfig();
  230.   static void SaveRootInfo();
  231.   static void KillOldRootInfo();
  232.   static int  rd_int();
  233. --- 88,95 ----
  234.   static void TrackPicValues();
  235.   static void MakeDispNames();
  236.   static int  Rect();
  237. ! /* static int  CheckForConfig();
  238. !    static Bool IsConfig();  */
  239.   static void SaveRootInfo();
  240.   static void KillOldRootInfo();
  241.   static int  rd_int();
  242. ***************
  243. *** 114,120 ****
  244. --- 115,125 ----
  245.     /*** Variable Initialization                       ***/
  246.     /*****************************************************/
  247.   
  248. + #ifdef SYSV
  249. +   getcwd(initpath, sizeof(initpath));
  250. + #else
  251.     getwd(initpath);
  252. + #endif
  253.   
  254.     /* init internal variables */
  255.     display = fname = whitestr = blackstr = NULL;
  256. ***************
  257. *** 450,455 ****
  258. --- 455,462 ----
  259.         mono = 1;
  260.     }
  261.     
  262. +   iconPix = XCreatePixmapFromBitmapData(theDisp, rootW, icon_bits,
  263. +          icon_width, icon_height, 1, 0, 1);
  264.   
  265.     /* try to load fonts */
  266.     if ( (mfinfo = XLoadQueryFont(theDisp,FONT1))==NULL && 
  267. ***************
  268. *** 480,485 ****
  269. --- 487,493 ----
  270.       if (dispDEEP>1) ncols = 1<<dispDEEP;
  271.       else ncols = 0;
  272.     }
  273. +   else if (ncols>256) ncols = 256;       /* so program doesn't blow up */
  274.   
  275.     if (numnames==0) {       /* no filenames.  build one-name (stdio) list */
  276.       namelist[0] = STDINSTR;
  277. ***************
  278. *** 534,539 ****
  279. --- 542,548 ----
  280.     /* Do The Thing... */
  281.     MainLoop();
  282.     Quit(0);
  283. +   return(0);
  284.   }
  285.   
  286.   
  287. ***************
  288. *** 1059,1068 ****
  289.           i=ClickCtrl(but_event->x, but_event->y);
  290.           if (i>=0) {
  291.             switch (i) {
  292. !           case BNEXT:   retval=NEXTPIC;  done=1;  break;
  293. !           case BPREV:   retval=PREVPIC;  done=1;  break;
  294.             case BSAVE:   DirBox(1); break;
  295. !           case BQUIT:   retval=QUIT;     done=1;  break;
  296.   
  297.             case BCROP:   DoCrop();  break;
  298.             case BUNCROP: UnCrop();  break;
  299. --- 1068,1077 ----
  300.           i=ClickCtrl(but_event->x, but_event->y);
  301.           if (i>=0) {
  302.             switch (i) {
  303. !           case BNEXT:   retval= NEXTPIC;  done=1;  break;
  304. !           case BPREV:   retval= PREVPIC;  done=1;  break;
  305.             case BSAVE:   DirBox(1); break;
  306. !           case BQUIT:   retval= QUIT;     done=1;  break;
  307.   
  308.             case BCROP:   DoCrop();  break;
  309.             case BUNCROP: UnCrop();  break;
  310. ***************
  311. *** 1106,1112 ****
  312.           if      (i==S_BOPEN) SelectDir(dList.selected);
  313.           else if (i==S_BCANC) DirBox(0);
  314.           else if (i==S_BSAVE) DoSave();
  315. !         else if (i==S_BQUIT) { retval=QUIT;  done=1; }
  316.         }
  317.   
  318.         else if (but_event->window == dList.win) {
  319. --- 1115,1121 ----
  320.           if      (i==S_BOPEN) SelectDir(dList.selected);
  321.           else if (i==S_BCANC) DirBox(0);
  322.           else if (i==S_BSAVE) DoSave();
  323. !         else if (i==S_BQUIT) { retval = QUIT;  done=1; }
  324.         }
  325.   
  326.         else if (but_event->window == dList.win) {
  327. ***************
  328. *** 1270,1275 ****
  329. --- 1279,1285 ----
  330.     XSetWindowAttributes xswa;
  331.     unsigned int         xswamask;
  332.     XWindowAttributes    xwa;
  333. +   XWMHints             xwmh;
  334.     XSizeHints           hints;
  335.     int                  i,x,y;
  336.     unsigned int         w,h;
  337. ***************
  338. *** 1291,1296 ****
  339. --- 1301,1308 ----
  340.       eWIDE = eWIDE / normFact;
  341.       eHIGH = eHIGH / normFact;
  342.     }
  343. +   if (eWIDE < 1) eWIDE = 1;
  344. +   if (eHIGH < 1) eHIGH = 1;
  345.   
  346.     if (fixedaspect && i&WidthValue && i&HeightValue)
  347. FixAspect(0,&eWIDE,&eHIGH);
  348.     else if (i&WidthValue && i&HeightValue) 
  349. ***************
  350. *** 1308,1313 ****
  351. --- 1320,1328 ----
  352.     if (x+eWIDE > dispWIDE) x = dispWIDE - eWIDE;   /* keep on screen */
  353.     if (y+eHIGH > dispHIGH) y = dispHIGH - eHIGH;
  354.   
  355. +   if (eWIDE < 1) eWIDE = 1;
  356. +   if (eHIGH < 1) eHIGH = 1;
  357.     hints.x = x;                  hints.y = y;
  358.     hints.width = eWIDE;          hints.height = eHIGH;
  359.     hints.max_width  = dispWIDE;  hints.max_height = dispHIGH;
  360. ***************
  361. *** 1325,1331 ****
  362.     }
  363.   
  364.     if (!mainW)
  365. !     mainW = XCreateWindow(theDisp,rootW,x,y,eWIDE,eHIGH,bwidth,0,
  366.                 CopyFromParent, CopyFromParent, xswamask, &xswa);
  367.   
  368.     sprintf(winname,"xv %s",name);
  369. --- 1340,1346 ----
  370.     }
  371.   
  372.     if (!mainW)
  373. !     mainW =
  374. XCreateWindow(theDisp,rootW,x,y,eWIDE,eHIGH,bwidth,CopyFromParent,
  375.                 CopyFromParent, CopyFromParent, xswamask, &xswa);
  376.   
  377.     sprintf(winname,"xv %s",name);
  378. ***************
  379. *** 1333,1338 ****
  380. --- 1348,1358 ----
  381.     XSetStandardProperties(theDisp,mainW,winname,iconname,None,
  382.                NULL,0,&hints);
  383.   
  384. +   xwmh.input = True;
  385. +   xwmh.flags = InputHint;
  386. +   if (iconPix) { xwmh.icon_pixmap = iconPix;  xwmh.flags |= IconPixmapHint; }
  387. +   XSetWMHints(theDisp, mainW, &xwmh);
  388.     if (!mainW) FatalError("can't create window!");
  389.   }
  390.   
  391. ***************
  392. *** 1383,1388 ****
  393. --- 1403,1411 ----
  394.       *h = dispHIGH;
  395.       *w = (int) (*w / a + .5);
  396.     }
  397. +   if (*w < 1) *w = 1;
  398. +   if (*h < 1) *h = 1;
  399.   }
  400.   
  401.   
  402. ***************
  403. *** 1547,1553 ****
  404.   XWindowAttributes *xwa;
  405.   {
  406.     /* sets window x,y,w,h values */
  407. !   XSizeHints        xsh;
  408.     Window            root, parent, *children, child;
  409.     unsigned int      nchildren;
  410.     XWindowAttributes pxwa;
  411. --- 1570,1576 ----
  412.   XWindowAttributes *xwa;
  413.   {
  414.     /* sets window x,y,w,h values */
  415. !   /*  XSizeHints        xsh; */
  416.     Window            root, parent, *children, child;
  417.     unsigned int      nchildren;
  418.     XWindowAttributes pxwa;
  419. ***************
  420. *** 1727,1733 ****
  421.   int mx,my;
  422.   {
  423.     Window       rW,cW;
  424. !   int          rx,ry,ox,oy,x,y,active;
  425.     unsigned int mask;
  426.     int          ty, w;
  427.     char         foo[40];
  428. --- 1750,1756 ----
  429.   int mx,my;
  430.   {
  431.     Window       rW,cW;
  432. !   int          rx,ry,ox,oy,x,y;
  433.     unsigned int mask;
  434.     int          ty, w;
  435.     char         foo[40];
  436. ***************
  437. *** 1835,1841 ****
  438.   }
  439.   
  440.   
  441.   /***********************************/
  442.   static int CheckForConfig()
  443.   {
  444. --- 1858,1864 ----
  445.   }
  446.   
  447.   
  448. ! #ifdef FOOBAR
  449.   /***********************************/
  450.   static int CheckForConfig()
  451.   {
  452. ***************
  453. *** 1864,1870 ****
  454.     }
  455.     return False;
  456.   }
  457.   
  458.   /***********************************/
  459.   void MakeRootPic()
  460. --- 1887,1893 ----
  461.     }
  462.     return False;
  463.   }
  464. ! #endif
  465.   
  466.   /***********************************/
  467.   void MakeRootPic()
  468.  
  469. *** ../xv1/xv.h    Wed Oct 17 23:25:56 1990
  470. --- ./xv.h    Wed Oct 17 14:57:57 1990
  471. ***************
  472. *** 16,34 ****
  473.    * This software is provided "as is" without any express or implied warranty.
  474.    */
  475.   
  476. ! #define REVDATE   "Rev: 10/9/90"
  477.   
  478.   
  479.   /* include files */
  480.   #include <stdio.h>
  481.   #include <math.h>
  482.   #include <ctype.h>
  483.   #include <string.h>
  484. - #include <memory.h>             /* for 'memset()' prototype */
  485.   extern int   errno;             /* this SHOULD be in errno.h */
  486.   extern char *sys_errlist[];     /* this SHOULD be in errno.h */
  487.   
  488.   
  489.   #include <X11/Xos.h>
  490.   #include <X11/Xlib.h>
  491.   #include <X11/Xutil.h>
  492. --- 16,47 ----
  493.    * This software is provided "as is" without any express or implied warranty.
  494.    */
  495.   
  496. ! #define REVDATE   "Rev: 10/17/90"
  497.   
  498. + #ifdef SVR4
  499. + #define DIRENT             /* SysV release 4 uses dirent */
  500. + #endif
  501.   
  502.   /* include files */
  503.   #include <stdio.h>
  504.   #include <math.h>
  505.   #include <ctype.h>
  506.   #include <string.h>
  507.   extern int   errno;             /* this SHOULD be in errno.h */
  508.   extern char *sys_errlist[];     /* this SHOULD be in errno.h */
  509.   
  510. + #ifndef __convexc__             /* Convex doesn't have <memory.h> */
  511. + #include <memory.h>             /* for 'memset()' prototype */
  512. + #endif
  513.   
  514. + /* neither IBM AOS 4.3, Convex, nor BSD 4.3 on VAX have <malloc.h> */
  515. + #if !defined(ibm032) && !defined(__convexc__) && \
  516. +     !(defined(vax) && !defined(ultrix))
  517. + #include <malloc.h>
  518. + #endif
  519.   #include <X11/Xos.h>
  520.   #include <X11/Xlib.h>
  521.   #include <X11/Xutil.h>
  522. ***************
  523. *** 35,46 ****
  524.   #include <X11/cursorfont.h>
  525.   #include <X11/keysym.h>
  526.   
  527. ! #ifndef ibm032            /* IBM RT 4.3 doesn't have malloc.h */
  528. ! #include <malloc.h>
  529.   #endif
  530.   
  531.   #ifdef NEEDSTIME
  532. - #include <sys/types.h>
  533.   #include <sys/timeb.h>
  534.   #include <signal.h>
  535.   #ifndef  sigmask
  536. --- 48,59 ----
  537.   #include <X11/cursorfont.h>
  538.   #include <X11/keysym.h>
  539.   
  540. ! #if defined(NEEDSTIME) || defined(NEEDSDIR)
  541. ! #include <sys/types.h>    /* only include <sys/types.h> once */
  542.   #endif
  543.   
  544.   #ifdef NEEDSTIME
  545.   #include <sys/timeb.h>
  546.   #include <signal.h>
  547.   #ifndef  sigmask
  548. ***************
  549. *** 49,55 ****
  550.   #endif
  551.   
  552.   #ifdef NEEDSDIR
  553. - #include <sys/types.h>
  554.   #include <sys/dir.h>
  555.   #include <sys/param.h>
  556.   #include <sys/stat.h>
  557. --- 62,67 ----
  558. ***************
  559. *** 259,264 ****
  560. --- 271,277 ----
  561.   WHERE XFontStruct   *mfinfo, *monofinfo;
  562.   WHERE Visual        *theVisual;
  563.   WHERE Cursor        arrow, cross;
  564. + WHERE Pixmap        iconPix;
  565.   
  566.   /* global vars used by LOAD routines */
  567.   WHERE byte          *pic;                   /* ptr to loaded picture */
  568.  
  569. *** ../xv1/xv24to8.c    Wed Oct 17 23:25:57 1990
  570. --- ./xv24to8.c    Wed Oct 17 18:22:37 1990
  571. ***************
  572. *** 912,924 ****
  573.        indicies (in pic) */
  574.   
  575.     unsigned long colors[256],col;
  576. !   int           i, nc, low, high, mid, k;
  577.     byte         *p, *pix;
  578.   
  579.     if (maxcol>256) maxcol = 256;
  580.   
  581.     /* put the first color in the table by hand */
  582. !   nc = 0;  
  583.   
  584.     for (i=w*h,p=pic24; i; i--) {
  585.       col  = (*p++ << 16);  
  586. --- 912,924 ----
  587.        indicies (in pic) */
  588.   
  589.     unsigned long colors[256],col;
  590. !   int           i, nc, low, high, mid;
  591.     byte         *p, *pix;
  592.   
  593.     if (maxcol>256) maxcol = 256;
  594.   
  595.     /* put the first color in the table by hand */
  596. !   nc = 0;  mid = 0;  
  597.   
  598.     for (i=w*h,p=pic24; i; i--) {
  599.       col  = (*p++ << 16);  
  600. ***************
  601. *** 937,946 ****
  602.       if (high < low) { /* didn't find color in list, add it. */
  603.         /* WARNING: this is an overlapped memory copy.  memcpy doesn't do
  604.        it correctly, hence 'bcopy', which claims to */
  605.         bcopy(&colors[low], &colors[low+1], (nc - low) * sizeof(unsigned
  606. long));
  607.         colors[low] = col;
  608.         nc++;
  609. -       if (nc>maxcol) return 0;
  610.       }
  611.     }
  612.   
  613. --- 937,946 ----
  614.       if (high < low) { /* didn't find color in list, add it. */
  615.         /* WARNING: this is an overlapped memory copy.  memcpy doesn't do
  616.        it correctly, hence 'bcopy', which claims to */
  617. +       if (nc>=maxcol) return 0;
  618.         bcopy(&colors[low], &colors[low+1], (nc - low) * sizeof(unsigned
  619. long));
  620.         colors[low] = col;
  621.         nc++;
  622.       }
  623.     }
  624.   
  625. *** ../xv1/xvdir.c    Wed Oct 17 23:25:59 1990
  626. --- ./xvdir.c    Wed Oct 17 18:25:46 1990
  627. ***************
  628. *** 336,342 ****
  629. --- 336,346 ----
  630.   
  631.     numdirnames = 0;
  632.   
  633. + #ifdef SYSV
  634. +   getcwd(path, sizeof(path));
  635. + #else
  636.     getwd(path);
  637. + #endif
  638.     if (path[strlen(path)-1] != '/')
  639.       strcat(path,"/");   /* tack on a trailing '/' to make path consistent */
  640.   
  641. ***************
  642. *** 365,371 ****
  643. --- 369,379 ----
  644.         /* skip over '.' and '..' */
  645.       }
  646.       else {
  647. + #ifdef DIRENT
  648. +       dirnames[i] = (char *) malloc(strlen(dp->d_name) + 3);
  649. + #else
  650.         dirnames[i] = (char *) malloc(dp->d_namlen + 2); /* +2=filetype
  651. + '\0'*/
  652. + #endif
  653.         if (!dirnames[i]) FatalError("malloc error while reading directory");
  654.         strcpy(dirnames[i]+1, dp->d_name);
  655.   
  656. ***************
  657. *** 374,382 ****
  658.   
  659.         if (lstat(dirnames[i]+1, &st)==0) {
  660.       ftype = st.st_mode & S_IFMT;   /* mask off uninteresting bits */
  661. !     if      (ftype == S_IFIFO)  dirnames[i][0] = C_FIFO;
  662.       else if (ftype == S_IFCHR)  dirnames[i][0] = C_CHR;
  663. -     else if (ftype == S_IFDIR)  dirnames[i][0] = C_DIR;
  664.       else if (ftype == S_IFBLK)  dirnames[i][0] = C_BLK;
  665.       else if (ftype == S_IFLNK)  dirnames[i][0] = C_LNK;
  666.       else if (ftype == S_IFSOCK) dirnames[i][0] = C_SOCK;
  667. --- 382,392 ----
  668.   
  669.         if (lstat(dirnames[i]+1, &st)==0) {
  670.       ftype = st.st_mode & S_IFMT;   /* mask off uninteresting bits */
  671. !     if      (ftype == S_IFDIR)  dirnames[i][0] = C_DIR;
  672. ! #ifdef S_IFIFO
  673. !     else if (ftype == S_IFIFO)  dirnames[i][0] = C_FIFO;
  674. ! #endif
  675.       else if (ftype == S_IFCHR)  dirnames[i][0] = C_CHR;
  676.       else if (ftype == S_IFBLK)  dirnames[i][0] = C_BLK;
  677.       else if (ftype == S_IFLNK)  dirnames[i][0] = C_LNK;
  678.       else if (ftype == S_IFSOCK) dirnames[i][0] = C_SOCK;
  679. ***************
  680. *** 534,540 ****
  681.       GammifyColors();
  682.     }
  683.         
  684. !       
  685.     i = RBWhich(formatRB);
  686.     switch (i) {
  687.     case 0:  rv = WriteGIF(fp,thepic,w, h, r, g, b, numcols, RBWhich(colorRB));
  688. --- 544,550 ----
  689.       GammifyColors();
  690.     }
  691.         
  692. !   rv = 0;
  693.     i = RBWhich(formatRB);
  694.     switch (i) {
  695.     case 0:  rv = WriteGIF(fp,thepic,w, h, r, g, b, numcols, RBWhich(colorRB));
  696.  
  697. *** ../xv1/xvfish.c    Wed Oct 17 23:26:22 1990
  698. --- ./xvfish.c    Wed Oct 17 14:26:35 1990
  699. ***************
  700. *** 102,108 ****
  701. --- 102,112 ----
  702.     if (!fish) return;
  703.     if (!fishrunning) return;
  704.        
  705. + #ifdef SVR4
  706. +   sighold(SIGALRM);
  707. + #else
  708.     sigblock(sigmask(SIGALRM));
  709. + #endif
  710.     bzero(&it, sizeof(it));
  711.     it.it_interval.tv_usec = 0L;
  712.     it.it_value.tv_usec = 0L;
  713. ***************
  714. *** 109,115 ****
  715. --- 113,123 ----
  716.   
  717.     setitimer(ITIMER_REAL, &it, (struct itimerval *)0);
  718.     signal(SIGALRM,SIG_DFL);
  719. + #ifdef SVR4
  720. +   sigrelse(SIGALRM);
  721. + #else
  722.     sigblock(0);
  723. + #endif
  724.     fishrunning = 0;
  725.   }
  726.   
  727. ***************
  728. *** 159,165 ****
  729. --- 167,177 ----
  730.     it.it_value.tv_usec = DELAY;
  731.   
  732.     signal(SIGALRM,dofish);
  733. + #ifdef SVR4
  734. +   sigrelse(SIGALRM);
  735. + #else
  736.     sigsetmask(0);
  737. + #endif
  738.     setitimer(ITIMER_REAL, &it, (struct itimerval *)0);
  739.   }
  740.   
  741.  
  742. *** ../xv1/xvgam.c    Wed Oct 17 23:25:59 1990
  743. --- ./xvgam.c    Wed Oct 17 18:39:01 1990
  744. ***************
  745. *** 254,260 ****
  746.     /* called when we've gotten a click inside graph window */
  747.   
  748.     Window       rW, cW;
  749. !   int          x, y, rx, ry, rval;
  750.     unsigned int mask;
  751.     int          h, vertonly, offx, offy;
  752.   
  753. --- 254,260 ----
  754.     /* called when we've gotten a click inside graph window */
  755.   
  756.     Window       rW, cW;
  757. !   int          x, y, rx, ry;
  758.     unsigned int mask;
  759.     int          h, vertonly, offx, offy;
  760.   
  761. ***************
  762. *** 377,383 ****
  763.        to map to white (255) (roughly).  Values between 50 and 200 will cover
  764.        the output range 0-255.  The reponse curve will be slightly 's'
  765. shaped. */
  766.   
  767. !   int i,j,k;
  768.     static int x[4] = {0,32,224,255};
  769.     static int y[4] = {0, 0,255,255};
  770.     float yf[4];
  771. --- 377,383 ----
  772.        to map to white (255) (roughly).  Values between 50 and 200 will cover
  773.        the output range 0-255.  The reponse curve will be slightly 's'
  774. shaped. */
  775.   
  776. !   int i,j;
  777.     static int x[4] = {0,32,224,255};
  778.     static int y[4] = {0, 0,255,255};
  779.     float yf[4];
  780. ***************
  781. *** 455,461 ****
  782.   {
  783.     int i,p, app;
  784.   
  785. !   app = 1;
  786.   
  787.     switch (cmd) {
  788.     case G_BAPPLY: DoGammaApply(1);  app = 0;  break;
  789. --- 455,461 ----
  790.   {
  791.     int i,p, app;
  792.   
  793. !   app = 1;  p=0;
  794.   
  795.     switch (cmd) {
  796.     case G_BAPPLY: DoGammaApply(1);  app = 0;  break;
  797. ***************
  798. *** 696,703 ****
  799.       if (max != 0.0) s = (del) / max;
  800.                  else s = 0.0;
  801.   
  802. !     if (s == 0.0) h = NOHUE;
  803. !     else {
  804.         rc = (max - rd) / del;
  805.         gc = (max - gd) / del;
  806.         bc = (max - bd) / del;
  807. --- 696,703 ----
  808.       if (max != 0.0) s = (del) / max;
  809.                  else s = 0.0;
  810.   
  811. !     h = NOHUE;
  812. !     if (s != 0.0) {
  813.         rc = (max - rd) / del;
  814.         gc = (max - gd) / del;
  815.         bc = (max - bd) / del;
  816.  
  817. *** ../xv1/xvmisc.c    Wed Oct 17 23:25:58 1990
  818. --- ./xvmisc.c    Wed Oct 17 18:19:15 1990
  819. ***************
  820. *** 62,67 ****
  821. --- 62,68 ----
  822.     Window               win;
  823.     XSetWindowAttributes xswa;
  824.     unsigned int         xswamask;
  825. +   XWMHints             xwmh;
  826.     XSizeHints           hints;
  827.     int                  i,x,y;
  828.   
  829. ***************
  830. *** 88,98 ****
  831.     xswamask = CWBackPixel | CWBorderPixel;
  832.   
  833.     win = XCreateWindow(theDisp, rootW, x, y, w, h, 
  834. !             bwidth, 0, CopyFromParent,
  835.               CopyFromParent, xswamask, &xswa);
  836.     if (!win) return(win);   /* leave immediately if couldn't create */
  837.   
  838.     XSetStandardProperties(theDisp, win, name, name, None, NULL, 0, &hints);
  839.     return(win);
  840.   }
  841.     
  842. --- 89,105 ----
  843.     xswamask = CWBackPixel | CWBorderPixel;
  844.   
  845.     win = XCreateWindow(theDisp, rootW, x, y, w, h, 
  846. !             bwidth, CopyFromParent, CopyFromParent,
  847.               CopyFromParent, xswamask, &xswa);
  848.     if (!win) return(win);   /* leave immediately if couldn't create */
  849.   
  850.     XSetStandardProperties(theDisp, win, name, name, None, NULL, 0, &hints);
  851. +   xwmh.input = True;
  852. +   xwmh.flags = InputHint;
  853. +   if (iconPix) { xwmh.icon_pixmap = iconPix;  xwmh.flags |= IconPixmapHint; }
  854. +   XSetWMHints(theDisp, win, &xwmh);
  855.     return(win);
  856.   }
  857.     
  858. ***************
  859. *** 1377,1382 ****
  860. --- 1384,1390 ----
  861.   {
  862.     Cursor c;
  863.   
  864. +   c = cross;
  865.     /* if n < 0   sets normal cursor in all windows
  866.        n = 0..6   cycles through fish cursors */
  867.   
  868. ***************
  869. *** 1450,1461 ****
  870. --- 1458,1477 ----
  871.     signal(SIGALRM,onalarm);
  872.     setitimer(ITIMER_REAL, &it, (struct itimerval *)0);
  873.     while (1) {
  874. + #ifdef SVR4
  875. +     sighold(SIGALRM);
  876. + #else
  877.       sigblock(sigmask(SIGALRM));  /* note:  have to block, so that ALRM */
  878. + #endif
  879.       if (timerdone) break;        /* doesn't occur between 'if (timerdone)' */
  880.       else sigpause(0);            /* and calling sigpause(0) */
  881.     }
  882.   
  883. + #ifdef SVR4
  884. +   sigrelse(SIGALRM);
  885. + #else
  886.     sigblock(0);                   /* turn ALRM blocking off */
  887. + #endif
  888.     signal(SIGALRM,SIG_DFL);
  889.   }
  890.   
  891.  
  892. *** ../xv1/xvpbm.c    Wed Oct 17 23:26:22 1990
  893. --- ./xvpbm.c    Wed Oct 17 20:29:09 1990
  894. ***************
  895. *** 54,60 ****
  896.     int    c, c1;
  897.     int    w, h, maxv, rv;
  898.   
  899. !   garbage = 0;
  900.   
  901.     /* open the stream, if necesary */
  902.     fp=fopen(fname,"r");
  903. --- 54,60 ----
  904.     int    c, c1;
  905.     int    w, h, maxv, rv;
  906.   
  907. !   garbage = maxv = 0;
  908.   
  909.     /* open the stream, if necesary */
  910.     fp=fopen(fname,"r");
  911. ***************
  912. *** 107,113 ****
  913.   int   w,h,raw;
  914.   {
  915.     byte *pix;
  916. !   int   i,j,k,bit;
  917.   
  918.   
  919.     SetISTR(ISTR_FORMAT,"PBM, %s format.  (%ld bytes)", 
  920. --- 107,113 ----
  921.   int   w,h,raw;
  922.   {
  923.     byte *pix;
  924. !   int   i,j,bit;
  925.   
  926.   
  927.     SetISTR(ISTR_FORMAT,"PBM, %s format.  (%ld bytes)", 
  928. ***************
  929. *** 138,144 ****
  930.   
  931.   
  932.     else {   /* read raw bits */
  933. !     int trunc = 0;
  934.   
  935.       for (i=0, pix=pic; i<h; i++)
  936.         for (j=0,bit=0; j<w; j++, pix++, bit++) {
  937. --- 138,144 ----
  938.   
  939.   
  940.     else {   /* read raw bits */
  941. !     int trunc = 0, k = 0;
  942.   
  943.       for (i=0, pix=pic; i<h; i++)
  944.         for (j=0,bit=0; j<w; j++, pix++, bit++) {
  945.  
  946. *** ../xv1/xvxbm.c    Wed Oct 17 23:26:21 1990
  947. --- ./xvxbm.c    Wed Oct 17 18:34:33 1990
  948. ***************
  949. *** 56,61 ****
  950. --- 56,62 ----
  951.     char   line[256];
  952.     byte   hex[256];
  953.   
  954. +   k = 0;
  955.   
  956.     fp=fopen(fname,"r");
  957.     if (!fp) return 1;
  958.  
  959. *** ../xv1/docs/bggen.man    Wed Oct 17 23:26:26 1990
  960. --- ./docs/bggen.man    Wed Oct 17 16:44:18 1990
  961. ***************
  962. *** 2,10 ****
  963.   .SH NAME
  964.   bggen \- generates colored backgrounds on X11 displays
  965.   .SH SYNTAX
  966. ! \fBbggen\fP [-s size] [-b bits] r1 g1 b1 [r2 g2 b2 ... rn gn bn]
  967.   .SH DESCRIPTION
  968. ! \fBbggen\fP is a program that generates a 1-pixel wide by size-pixels high
  969.   vertical stripe.  The top of the stripe is in color (r1,g1,b1), and the
  970.   bottom of the stripe is in color (rn,gn,bn).  Intermediate colors are 
  971.   interpolated between these colors.  If you specify more than 2 colors, the
  972. --- 2,10 ----
  973.   .SH NAME
  974.   bggen \- generates colored backgrounds on X11 displays
  975.   .SH SYNTAX
  976. ! \fBbggen\fP [-w width] [-s size] [-b bits] r1 g1 b1 [r2 g2 b2 ... rn gn bn]
  977.   .SH DESCRIPTION
  978. ! \fBbggen\fP is a program that generates a width-pixel wide by
  979. size-pixels high
  980.   vertical stripe.  The top of the stripe is in color (r1,g1,b1), and the
  981.   bottom of the stripe is in color (rn,gn,bn).  Intermediate colors are 
  982.   interpolated between these colors.  If you specify more than 2 colors, the
  983. ***************
  984. *** 30,35 ****
  985. --- 30,39 ----
  986.   otherwise you will get a bizarre repeating effect, that you probably didn't 
  987.   want.  Note:  If you specify small values of '-s', you can get some neat
  988.   effects.
  989. + .PP
  990. + The '-w' argument has been added to improve the performance of various
  991. + stippling algorithms (as in XV).  More information to work with, and such.
  992. + Try using '-w 16' on these command lines to see what is meant.
  993.   .SH TRY THESE
  994.   .nf
  995.   Light Blue to Dark Blue
  996. ***************
  997. *** 52,54 ****
  998. --- 56,59 ----
  999.   and also by hexadecimal value.
  1000.   .SH AUTHOR
  1001.   John Bradley  -  bradley@cis.upenn.edu
  1002.  
  1003. *** /dev/null    Thu Oct 18 00:00:14 1990
  1004. --- ./Imakefile    Wed Oct 17 15:11:26 1990
  1005. ***************
  1006. *** 0 ****
  1007. --- 1,69 ----
  1008. + /*
  1009. +  * optimization/debugging options for your C compiler
  1010. +  * Note:  If you are running on a POSIX-compatible machine, such as an
  1011. +  *        IBM RS6000, you MAY need to add '-DDIRENT' to DEFINES.  To
  1012. determine
  1013. +  *        if this is the case, do a 'man readdir' on your machine.  If
  1014. +  *        readdir() returns a pointer to 'struct direct', you will not have
  1015. +  *        to change anything.  If, however, readdir() returns a pointer to
  1016. +  *        'struct dirent', you will have to add the '-DDIRENT' to DEFINES
  1017. +  */
  1018. + /* 
  1019. +  * Vax BSD and IBM AOS don't have vprintf or vsprintf.
  1020. +  * Note that our local library versions of sprintf have been updated
  1021. +  * to return int, the number of characters in the formatted string,
  1022. +  * whereas the versions in stock 4.3BSD do not so return.  You may
  1023. +  * have to remove the "-DINTSPRINTF" below if you're compiling for
  1024. +  * stock 4.3BSD or for some other Vax or RT library package where
  1025. +  * sprintf returns char *.
  1026. +  *
  1027. +  * Also, I define NOVOID on the Vax because I'm using pcc to compile.
  1028. +  * If you use gcc or some other better compiler, this should not be
  1029. +  * necessary.  I define NOSTDHDRS on the RT because we don't have
  1030. +  * standard ANSI header files installed for the RT, even though the RT
  1031. +  * compiler claims to be ANSI-compliant.
  1032. +  */
  1033. + #if defined(VaxArchitecture) && !defined(UltrixArchitecture)
  1034. + DEFINES=    -DNEED_VPRINTF -DINTSPRINTF -DLONGINT -DNOVOID
  1035. + #else 
  1036. + #  if defined(RtArchitecture) && !defined(AIXArchitecture)
  1037. + DEFINES=    -DNEED_VPRINTF -DINTSPRINTF -DLONGINT -DNOSTDHDRS
  1038. + #  endif
  1039. + #endif
  1040. + SYS_LIBRARIES=    -lX11 -lm
  1041. + BITMAPS = bitmaps/grasp bitmaps/penn bitmaps/down bitmaps/down1 \
  1042. +           bitmaps/up bitmaps/up1 bitmaps/scrlgray bitmaps/gray50 \
  1043. +           bitmaps/gray25 bitmaps/i_fifo bitmaps/i_chr bitmaps/i_dir \
  1044. +           bitmaps/i_blk bitmaps/i_lnk bitmaps/i_sock bitmaps/i_reg \
  1045. +           bitmaps/rb_off bitmaps/rb_on bitmaps/rb_off1 bitmaps/rb_on1 \
  1046. +           bitmaps/fc_left bitmaps/fc_leftm bitmaps/fc_mid bitmaps/fc_midm \
  1047. +           bitmaps/fc_right bitmaps/fc_rightm bitmaps/fc_left1 \
  1048. +           bitmaps/fc_left1m bitmaps/fc_right1 bitmaps/fc_right1m \
  1049. +       bitmaps/icon
  1050. + SRCS1 =    xv.c xv24to8.c xvbutt.c xvctrl.c xvdir.c xvfish.c xvgam.c\
  1051. +     xvgif.c xvgifwr.c xvinfo.c xvmisc.c xvpbm.c xvpm.c xvscrl.c\
  1052. +     xvxbm.c vprintf.c
  1053. + OBJS1 =    xv.o xv24to8.o xvbutt.o xvctrl.o xvdir.o xvfish.o xvgam.o\
  1054. +     xvgif.o xvgifwr.o xvinfo.o xvmisc.o xvpbm.o xvpm.o xvscrl.o \
  1055. +     xvxbm.o vprintf.o
  1056. + SRCS2=    bggen.c
  1057. + OBJS2=    bggen.o
  1058. + PROGRAMS= xv bggen
  1059. + ComplexProgramTarget_1(xv,,)
  1060. + ComplexProgramTarget_2(bggen,,)
  1061. + tar:
  1062. +     tar cf xv.tar Makefile *.c *.h bitmaps docs $(MISC)
  1063. + bitmaps.h: $(BITMAPS)
  1064. +     cat $(BITMAPS) > bitmaps.h
  1065. + depend:: bitmaps.h
  1066.  
  1067. *** /dev/null    Thu Oct 18 00:00:14 1990
  1068. --- ./Makefile.std    Wed Oct 17 22:54:52 1990
  1069. ***************
  1070. *** 0 ****
  1071. --- 1,86 ----
  1072. + # Makefile for xv
  1073. + #
  1074. + # your C compiler of choice
  1075. + CC = cc
  1076. + # optimization/debugging options for your C compiler
  1077. + # Note:  If you are running on a POSIX-compatible machine, such as an
  1078. + #        IBM RS6000, you MAY need to add '-DDIRENT' to CFLAGS.  To determine
  1079. + #        if this is the case, do a 'man readdir' on your machine.  If
  1080. + #        readdir() returns a pointer to 'struct direct', you will not have
  1081. + #        to change anything.  If, however, readdir() returns a pointer to
  1082. + #        'struct dirent', you will have to add the '-DDIRENT' to CFLAGS
  1083. + # IF YOUR MACHINE DOESN'T HAVE 'vprintf()' OR 'vsprintf()'
  1084. + #
  1085. + # Vax BSD and IBM AOS don't have vprintf or vsprintf.
  1086. + # Note that our local library versions of sprintf have been updated
  1087. + # to return int, the number of characters in the formatted string,
  1088. + # whereas the versions in stock 4.3BSD do not so return.  You may
  1089. + # have to remove the "-DINTSPRINTF" below if you're compiling for
  1090. + # stock 4.3BSD or for some other Vax or RT library package where
  1091. + # sprintf returns char *.
  1092. + #
  1093. + # Also, I define NOVOID on the Vax because I'm using pcc to compile.
  1094. + # If you use gcc or some other better compiler, this should not be
  1095. + # necessary.  I define NOSTDHDRS on the RT because we don't have
  1096. + # standard ANSI header files installed for the RT, even though the RT
  1097. + # compiler claims to be ANSI-compliant.
  1098. + #
  1099. + #  (for BSD 4.3 VAX, add the following to CFLAGS)
  1100. + #          -DNEED_VPRINTF -DINTSPRINTF -DLONGINT -DNOVOID
  1101. + #  (for (stock) IBM RT AOS 4.3, add the following to CFLAGS)
  1102. + #          -DNEED_VPRINTF -DLONGINT -DNOSTDHDRS
  1103. + CFLAGS = -O
  1104. + LIBS = -lX11 -lm
  1105. + BITMAPS = bitmaps/grasp bitmaps/penn bitmaps/down bitmaps/down1 \
  1106. +       bitmaps/up bitmaps/up1 bitmaps/scrlgray bitmaps/gray50 \
  1107. +       bitmaps/gray25 bitmaps/i_fifo bitmaps/i_chr bitmaps/i_dir \
  1108. +       bitmaps/i_blk bitmaps/i_lnk bitmaps/i_sock bitmaps/i_reg \
  1109. +       bitmaps/rb_off bitmaps/rb_on bitmaps/rb_off1 bitmaps/rb_on1 \
  1110. +       bitmaps/fc_left bitmaps/fc_leftm bitmaps/fc_mid bitmaps/fc_midm \
  1111. +       bitmaps/fc_right bitmaps/fc_rightm bitmaps/fc_left1 \
  1112. +       bitmaps/fc_left1m bitmaps/fc_right1 bitmaps/fc_right1m \
  1113. +       bitmaps/icon
  1114. + OBJS =     xv.o xvmisc.o xv24to8.o xvgif.o xvpm.o xvinfo.o xvctrl.o xvscrl.o \
  1115. +     xvgifwr.o xvdir.o xvbutt.o xvpbm.o xvxbm.o xvgam.o xvfish.o \
  1116. +     vprintf.o
  1117. + MISC = README PATCHLEVEL
  1118. + .c.o:    ; $(CC) -c $(CFLAGS) -o $@ $*.c
  1119. + all: xv bggen
  1120. + xv: $(OBJS)
  1121. +     $(CC) $(CFLAGS) -o xv $(OBJS) $(LIBS)
  1122. + bggen: bggen.c
  1123. +     $(CC) $(CFLAGS) -o bggen bggen.c
  1124. +     
  1125. + clean:
  1126. +     rm -f $(OBJS)
  1127. + tar:
  1128. +     tar cf xv.tar Makefile* Imakefile *.c *.h bitmaps docs $(MISC)
  1129. + xv.3100: bitmaps.h
  1130. +     cc -O3 *.c -o xv $(XLIB)
  1131. + $(OBJS):   xv.h
  1132. + xv.o:      bitmaps.h
  1133. + xvmisc.o:  bitmaps.h
  1134. + xvinfo.o:  bitmaps.h
  1135. + xvctrl.o:  bitmaps.h
  1136. + xvscrl.o:  bitmaps.h
  1137. + xvbutt.o:  bitmaps.h
  1138. + bitmaps.h: $(BITMAPS)
  1139. +     cat $(BITMAPS) > bitmaps.h
  1140.  
  1141. *** /dev/null    Thu Oct 18 00:00:14 1990
  1142. --- ./PATCHLEVEL    Wed Oct 17 23:38:43 1990
  1143. ***************
  1144. *** 0 ****
  1145. --- 1,16 ----
  1146. + Current patchlevel:  1
  1147. + Rev: 10/9/90    (patchlevel 0  -  initial release)
  1148. + Rev: 10/17/90   (patchlevel 1)
  1149. + ------------------------------
  1150. + Imakefile added            (David Elliot    (dce@smsc.sony.com))
  1151. + System V release 4 mods        (David Elliot    (dce@smsc.sony.com))
  1152. + Bug in 'quick check' fixed    (Arthur Olson    (ado@elsie.nci.nih.gov))
  1153. + Mods for Convex machines    (Anthony Datri   (datri@convex.com))
  1154. + 'vprintf' module added         (Jonathan Kamens (jik@pit-manager.mit.edu))
  1155. + window creation bug fixed
  1156. + added icon
  1157. + fixed 'Input Focus' probs
  1158. + added '-w' flag to bggen
  1159. + various cleanups to shut up 'noisy' compilers
  1160.  
  1161. *** /dev/null    Thu Oct 18 00:00:14 1990
  1162. --- ./vprintf.c    Wed Oct 17 22:36:26 1990
  1163. ***************
  1164. *** 0 ****
  1165. --- 1,306 ----
  1166. + #ifdef NEED_VPRINTF
  1167. + #include <stdio.h>
  1168. + /* Portable vsprintf  by Robert A. Larson <blarson@skat.usc.edu> */
  1169. + /* Portable vfprintf  by Robert A. Larson <blarson@skat.usc.edu> */
  1170. + /* Copyright 1989 Robert A. Larson.
  1171. +  * Distribution in any form is allowed as long as the author
  1172. +  * retains credit, changes are noted by their author and the
  1173. +  * copyright message remains intact.  This program comes as-is
  1174. +  * with no warentee of fitness for any purpouse.
  1175. +  *
  1176. +  * Thanks to Doug Gwen, Chris Torek, and others who helped clarify
  1177. +  * the ansi printf specs.
  1178. +  *
  1179. +  * Please send any bug fixes and improvments to blarson@skat.usc.edu .
  1180. +  * The use of goto is NOT a bug.
  1181. +  */
  1182. + /* Feb    7, 1989        blarson        First usenet release */
  1183. + /* This code implements the vsprintf function, without relying on
  1184. +  * the existance of _doprint or other system specific code.
  1185. +  *
  1186. +  * Define NOVOID if void * is not a supported type.
  1187. +  *
  1188. +  * Two compile options are available for efficency:
  1189. +  *    INTSPRINTF    should be defined if sprintf is int and returns
  1190. +  *            the number of chacters formated.
  1191. +  *    LONGINT        should be defined if sizeof(long) == sizeof(int)
  1192. +  *
  1193. +  *    They only make the code smaller and faster, they need not be
  1194. +  *    defined.
  1195. +  *
  1196. +  * UNSIGNEDSPECIAL should be defined if unsigned is treated differently
  1197. +  * than int in argument passing.  If this is definded, and LONGINT is not,
  1198. +  * the compiler must support the type unsingned long.
  1199. +  *
  1200. +  * Most quirks and bugs of the available sprintf fuction are duplicated,
  1201. +  * however * in the width and precision fields will work correctly
  1202. +  * even if sprintf does not support this, as will the n format.
  1203. +  *
  1204. +  * Bad format strings, or those with very long width and precision
  1205. +  * fields (including expanded * fields) will cause undesired results.
  1206. +  */
  1207. + #ifdef OSK        /* os9/68k can take advantage of both */
  1208. + #define LONGINT
  1209. + #define INTSPRINTF
  1210. + #endif
  1211. + /* This must be a typedef not a #define! */
  1212. + #ifdef NOVOID
  1213. + typedef char *pointer;
  1214. + #else
  1215. + typedef void *pointer;
  1216. + #endif
  1217. + #ifdef    INTSPRINTF
  1218. + #define Sprintf(string,format,arg)    (sprintf((string),(format),(arg)))
  1219. + #else
  1220. + #define Sprintf(string,format,arg)    (\
  1221. +     sprintf((string),(format),(arg)),\
  1222. +     strlen(string)\
  1223. + )
  1224. + #endif
  1225. + #if defined(__STDC__) && !defined(NOSTDHDRS)
  1226. + #include <stdarg.h>
  1227. + #else
  1228. + #include <varargs.h>
  1229. + #endif
  1230. + typedef int *intp;
  1231. + int vsprintf(dest, format, args)
  1232. + char *dest;
  1233. + register char *format;
  1234. + va_list args;
  1235. + {
  1236. +     register char *dp = dest;
  1237. +     register char c;
  1238. +     register char *tp;
  1239. +     char tempfmt[64];
  1240. + #ifndef LONGINT
  1241. +     int longflag;
  1242. + #endif
  1243. +     tempfmt[0] = '%';
  1244. +     while( (c = *format++) != 0) {
  1245. +     if(c=='%') {
  1246. +         tp = &tempfmt[1];
  1247. + #ifndef LONGINT
  1248. +         longflag = 0;
  1249. + #endif
  1250. + continue_format:
  1251. +         switch(c = *format++) {
  1252. +         case 's':
  1253. +             *tp++ = c;
  1254. +             *tp = '\0';
  1255. +             dp += Sprintf(dp, tempfmt, va_arg(args, char *));
  1256. +             break;
  1257. +         case 'u':
  1258. +         case 'x':
  1259. +         case 'o':
  1260. +         case 'X':
  1261. + #ifdef UNSIGNEDSPECIAL
  1262. +             *tp++ = c;
  1263. +             *tp = '\0';
  1264. + #ifndef LONGINT
  1265. +             if(longflag)
  1266. +             dp += Sprintf(dp, tempfmt, va_arg(args, unsigned long));
  1267. +             else
  1268. + #endif
  1269. +             dp += Sprintf(dp, tempfmt, va_arg(args, unsigned));
  1270. +             break;
  1271. + #endif
  1272. +         case 'd':
  1273. +         case 'c':
  1274. +         case 'i':
  1275. +             *tp++ = c;
  1276. +             *tp = '\0';
  1277. + #ifndef LONGINT
  1278. +             if(longflag)
  1279. +             dp += Sprintf(dp, tempfmt, va_arg(args, long));
  1280. +             else
  1281. + #endif
  1282. +             dp += Sprintf(dp, tempfmt, va_arg(args, int));
  1283. +             break;
  1284. +         case 'f':
  1285. +         case 'e':
  1286. +         case 'E':
  1287. +         case 'g':
  1288. +         case 'G':
  1289. +             *tp++ = c;
  1290. +             *tp = '\0';
  1291. +             dp += Sprintf(dp, tempfmt, va_arg(args, double));
  1292. +             break;
  1293. +         case 'p':
  1294. +             *tp++ = c;
  1295. +             *tp = '\0';
  1296. +             dp += Sprintf(dp, tempfmt, va_arg(args, pointer));
  1297. +             break;
  1298. +         case '-':
  1299. +         case '+':
  1300. +         case '0':
  1301. +         case '1':
  1302. +         case '2':
  1303. +         case '3':
  1304. +         case '4':
  1305. +         case '5':
  1306. +         case '6':
  1307. +         case '7':
  1308. +         case '8':
  1309. +         case '9':
  1310. +         case '.':
  1311. +         case ' ':
  1312. +         case '#':
  1313. +         case 'h':
  1314. +             *tp++ = c;
  1315. +             goto continue_format;
  1316. +         case 'l':
  1317. + #ifndef LONGINT
  1318. +             longflag = 1;
  1319. +             *tp++ = c;
  1320. + #endif
  1321. +             goto continue_format;
  1322. +         case '*':
  1323. +             tp += Sprintf(tp, "%d", va_arg(args, int));
  1324. +             goto continue_format;
  1325. +         case 'n':
  1326. +             *va_arg(args, intp) = dp - dest;
  1327. +             break;
  1328. +         case '%':
  1329. +         default:
  1330. +             *dp++ = c;
  1331. +             break;
  1332. +         }
  1333. +     } else *dp++ = c;
  1334. +     }
  1335. +     *dp = '\0';
  1336. +     return dp - dest;
  1337. + }
  1338. + int vfprintf(dest, format, args)
  1339. + FILE *dest;
  1340. + register char *format;
  1341. + va_list args;
  1342. + {
  1343. +     register char c;
  1344. +     register char *tp;
  1345. +     register int count = 0;
  1346. +     char tempfmt[64];
  1347. + #ifndef LONGINT
  1348. +     int longflag;
  1349. + #endif
  1350. +     tempfmt[0] = '%';
  1351. +     while(c = *format++) {
  1352. +     if(c=='%') {
  1353. +         tp = &tempfmt[1];
  1354. + #ifndef LONGINT
  1355. +         longflag = 0;
  1356. + #endif
  1357. + continue_format:
  1358. +         switch(c = *format++) {
  1359. +         case 's':
  1360. +             *tp++ = c;
  1361. +             *tp = '\0';
  1362. +             count += fprintf(dest, tempfmt, va_arg(args, char *));
  1363. +             break;
  1364. +         case 'u':
  1365. +         case 'x':
  1366. +         case 'o':
  1367. +         case 'X':
  1368. + #ifdef UNSIGNEDSPECIAL
  1369. +             *tp++ = c;
  1370. +             *tp = '\0';
  1371. + #ifndef LONGINT
  1372. +             if(longflag)
  1373. +             count += fprintf(dest, tempfmt, va_arg(args, unsigned long));
  1374. +             else
  1375. + #endif
  1376. +             count += fprintf(dest, tempfmt, va_arg(args, unsigned));
  1377. +             break;
  1378. + #endif
  1379. +         case 'd':
  1380. +         case 'c':
  1381. +         case 'i':
  1382. +             *tp++ = c;
  1383. +             *tp = '\0';
  1384. + #ifndef LONGINT
  1385. +             if(longflag)
  1386. +             count += fprintf(dest, tempfmt, va_arg(args, long));
  1387. +             else
  1388. + #endif
  1389. +             count += fprintf(dest, tempfmt, va_arg(args, int));
  1390. +             break;
  1391. +         case 'f':
  1392. +         case 'e':
  1393. +         case 'E':
  1394. +         case 'g':
  1395. +         case 'G':
  1396. +             *tp++ = c;
  1397. +             *tp = '\0';
  1398. +             count += fprintf(dest, tempfmt, va_arg(args, double));
  1399. +             break;
  1400. +         case 'p':
  1401. +             *tp++ = c;
  1402. +             *tp = '\0';
  1403. +             count += fprintf(dest, tempfmt, va_arg(args, pointer));
  1404. +             break;
  1405. +         case '-':
  1406. +         case '+':
  1407. +         case '0':
  1408. +         case '1':
  1409. +         case '2':
  1410. +         case '3':
  1411. +         case '4':
  1412. +         case '5':
  1413. +         case '6':
  1414. +         case '7':
  1415. +         case '8':
  1416. +         case '9':
  1417. +         case '.':
  1418. +         case ' ':
  1419. +         case '#':
  1420. +         case 'h':
  1421. +             *tp++ = c;
  1422. +             goto continue_format;
  1423. +         case 'l':
  1424. + #ifndef LONGINT
  1425. +             longflag = 1;
  1426. +             *tp++ = c;
  1427. + #endif
  1428. +             goto continue_format;
  1429. +         case '*':
  1430. +             tp += Sprintf(tp, "%d", va_arg(args, int));
  1431. +             goto continue_format;
  1432. +         case 'n':
  1433. +             *va_arg(args, intp) = count;
  1434. +             break;
  1435. +         case '%':
  1436. +         default:
  1437. +             putc(c, dest);
  1438. +             count++;
  1439. +             break;
  1440. +         }
  1441. +     } else {
  1442. +         putc(c, dest);
  1443. +         count++;
  1444. +     }
  1445. +     }
  1446. +     return count;
  1447. + }
  1448. + vprintf(format, args)
  1449. + char *format;
  1450. + va_list args;
  1451. + {
  1452. +     return vfprintf(stdout, format, args);
  1453. + }
  1454. + #endif
  1455.  
  1456. *** /dev/null    Thu Oct 18 00:00:14 1990
  1457. --- ./bitmaps/icon    Wed Oct 17 14:13:05 1990
  1458. ***************
  1459. *** 0 ****
  1460. --- 1,18 ----
  1461. + #define icon_width 48
  1462. + #define icon_height 29
  1463. + static char icon_bits[] = {
  1464. +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1465. +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1466. +    0x3e, 0x00, 0x7c, 0x7c, 0x00, 0x7c, 0x5c, 0x00, 0x2e, 0x5c, 0x00, 0x5c,
  1467. +    0xb8, 0x00, 0x17, 0xb8, 0x00, 0x2e, 0x70, 0x81, 0x0b, 0xb8, 0x00, 0x2e,
  1468. +    0x70, 0x81, 0x0b, 0x70, 0x01, 0x17, 0xe0, 0xc2, 0x05, 0x70, 0x01, 0x17,
  1469. +    0xc0, 0xe5, 0x02, 0xe0, 0x82, 0x0b, 0x80, 0x7b, 0x01, 0xe0, 0x82, 0x0b,
  1470. +    0x00, 0xb7, 0x00, 0xc0, 0xc5, 0x05, 0x00, 0x56, 0x00, 0xc0, 0xc5, 0x05,
  1471. +    0x00, 0x2e, 0x00, 0x80, 0xeb, 0x02, 0x00, 0x56, 0x00, 0x80, 0xeb, 0x02,
  1472. +    0x00, 0xb7, 0x00, 0x00, 0x77, 0x01, 0x80, 0x7b, 0x01, 0x00, 0x77, 0x01,
  1473. +    0xc0, 0xe5, 0x02, 0x00, 0xae, 0x00, 0xe0, 0xc2, 0x05, 0x00, 0xae, 0x00,
  1474. +    0x70, 0x81, 0x0b, 0x00, 0x5c, 0x00, 0x70, 0x81, 0x0b, 0x00, 0x5c, 0x00,
  1475. +    0xb8, 0x00, 0x17, 0x00, 0x38, 0x00, 0x5c, 0x00, 0x2e, 0x00, 0x38, 0x00,
  1476. +    0x3e, 0x00, 0x7c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1477. +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  1478. +    0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
  1479.  
  1480.  
  1481. dan
  1482. ----------------------------------------------------
  1483. O'Reilly && Associates   argv@sun.com / argv@ora.com
  1484. Opinions expressed reflect those of the author only.
  1485.